package com.crane.framework.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.crane.framework.dto.common.TreeNodeDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = true)
public class OrgTreeDTO extends TreeNodeDTO {
  /** 组织机构名 */
  @Size(max = 255, message = "编码长度不能超过255")
  @TableField(value = "name")
  @Schema(description = "组织机构名")
  @Length(max = 255, message = "编码长度不能超过255")
  private String name;

  /** 本机构路径（作为标识） */
  @Size(max = 255, message = "编码长度不能超过255")
  @TableField(value = "path")
  @Schema(description = "本机构路径（作为标识）")
  @Length(max = 255, message = "编码长度不能超过255")
  private String path;

  /** 全路径 */
  @TableField(value = "full_path")
  @Schema(description = "全路径")
  private String fullPath;

  /** 领导人id */
  @Size(max = 64, message = "编码长度不能超过64")
  @TableField(value = "leader_id")
  @Schema(description = "领导人id")
  @Length(max = 64, message = "编码长度不能超过64")
  private String leaderId;

  /** 创建时间 */
  @TableField(value = "gmt_create")
  @Schema(description = "创建时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime gmtCreate;

  /** 修改时间 */
  @TableField(value = "gmt_modified")
  @Schema(description = "修改时间")
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  private LocalDateTime gmtModified;
}
